package rad.framework.mda.generator.template.main.webapp;

import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.*;
import java.util.*;
import rad.framework.mda.generator.util.*;

public class ListReport
{
  protected static String nl;
  public static synchronized ListReport create(String lineSeparator)
  {
    nl = lineSeparator;
    ListReport result = new ListReport();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "<ui:composition " + NL + "\txmlns:ui=\"http://java.sun.com/jsf/facelets\"" + NL + "\txmlns:f=\"http://java.sun.com/jsf/core\"" + NL + "\txmlns:s=\"http://jboss.com/products/seam/taglib\"" + NL + "\txmlns:p=\"http://jboss.com/products/seam/pdf\"" + NL + "\txmlns:tt=\"https://code.google.com/p/rad-framework/pdf\"" + NL + "\ttemplate=\"#{theme.pdflist}\">" + NL + "\t" + NL + "\t<ui:param name=\"title\" value=\"#{messages['";
  protected final String TEXT_2 = "ListReportTitle']}\"/>" + NL + "\t<ui:param name=\"finder\" value=\"#{";
  protected final String TEXT_3 = "Finder}\"/>" + NL + "\t<ui:param name=\"result\" value=\"#{";
  protected final String TEXT_4 = "Finder.reportResult}\"/>" + NL + "\t" + NL + "\t<ui:define name=\"charts\">";
  protected final String TEXT_5 = NL + "\t\t<tt:chart title=\"#{messages['";
  protected final String TEXT_6 = "Chart']}\" data=\"#{";
  protected final String TEXT_7 = "Finder.";
  protected final String TEXT_8 = "PieChart.image}\" />";
  protected final String TEXT_9 = NL + "\t\t<tt:chart title=\"#{messages['";
  protected final String TEXT_10 = "Chart']}\" data=\"#{";
  protected final String TEXT_11 = "Finder.";
  protected final String TEXT_12 = "PieChart.image}\" />";
  protected final String TEXT_13 = NL + "\t</ui:define>" + NL + "" + NL + "</ui:composition>";
  protected final String TEXT_14 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    

    Class uml2Class = (Class) argument;
    String uncapClassName = NameHelper.getUncapName(uml2Class);
    String capClassName = NameHelper.getCapName(uml2Class);
    stringBuffer.append(TEXT_1);
    stringBuffer.append(capClassName);
    stringBuffer.append(TEXT_2);
    stringBuffer.append(uncapClassName);
    stringBuffer.append(TEXT_3);
    stringBuffer.append(uncapClassName);
    stringBuffer.append(TEXT_4);
    for (Iterator<Property> i=EnumerationHelper.getAllEnumerations(uml2Class); i.hasNext();) { Property property = i.next();
    stringBuffer.append(TEXT_5);
    stringBuffer.append(capClassName);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_6);
    stringBuffer.append(uncapClassName);
    stringBuffer.append(TEXT_7);
    stringBuffer.append(NameHelper.uncapSafeName(property));
    stringBuffer.append(TEXT_8);
    }
    for (Iterator<Property> l=ClassHelper.getAllManyToOneProperties(uml2Class); l.hasNext();) { Property property = l.next();
    if (!ClassHelper.isComposite(property)) {
    stringBuffer.append(TEXT_9);
    stringBuffer.append(capClassName);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_10);
    stringBuffer.append(uncapClassName);
    stringBuffer.append(TEXT_11);
    stringBuffer.append(NameHelper.uncapSafeName(property));
    stringBuffer.append(TEXT_12);
    }}
    stringBuffer.append(TEXT_13);
    stringBuffer.append(TEXT_14);
    return stringBuffer.toString();
  }
}
